import axios from "axios"

export const getBaseUrl = () => {
	return process.env.NODE_ENV === "production" ? location.origin + "/" : import.meta.env.VITE_APP_URL
}

axios.defaults.headers["Content-Type"] = "application/json;charset=utf-8"
axios.defaults.headers["accept"] = "text/plain"
const service = axios.create({
	baseURL: getBaseUrl(),
	timeout: 30000
})

export default function request(data) {
	return service(data).then((res) => res.data)
}
